import 'dart:typed_data';

import 'package:pointycastle/src/utils.dart';

Uint8List? decodeHexString(String input) {
  if(input.length % 2 != 0){
    return null;
  }
  try {
    return Uint8List.fromList(
      List.generate(
        input.length ~/ 2,
            (i) => int.parse(input.substring(i * 2, (i * 2) + 2), radix: 16),
      ).toList(),
    );
  }on FormatException{
    return null;
  }
}

class ScriptDataModel {
  final String? action;
  final dynamic data;

  ScriptDataModel({this.action, this.data});

  ScriptDataModel.fromJson(Map map)
      : action = map['action'],
        data = map['data'];
}